- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
Changing prop type of body from any to string. #14674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
 | 
| WalkthroughThe pull request includes updates to multiple files within the Gmail component, primarily focusing on incrementing version numbers for various action and source modules. The changes affect the  Changes
 Possibly related PRs
 Suggested labels
 Suggested reviewers
 Poem
 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit: 
 Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
 Other keywords and placeholders
 CodeRabbit Configuration File ( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (5)
components/gmail/sources/new-email-received/new-email-received.mjs (5)
Line range hint
279-285: Enhance subscription name generation for securityThe subscription name is derived directly from the webhook endpoint URL, which could expose sensitive information in Google Cloud Console.
Consider using a UUID instead:
- const subscriptionName = this.convertNameToValidPubSubTopicName(pushEndpoint); + const subscriptionName = this.convertNameToValidPubSubTopicName(`pd-subscription-${uuidv4()}`);
Line range hint
279-294: Add subscription configuration for better resource managementThe subscription lacks configuration for message retention and expiration.
Consider adding these configurations:
const subscriptionOptions = { pushConfig: { pushEndpoint, }, + messageRetentionDuration: { + seconds: 600, // 10 minutes + }, + expirationPolicy: { + ttl: { + seconds: 86400, // 24 hours + }, + }, };
Line range hint
419-428: Enhance error handling in getMessageDetailsThe current error handling suppresses the actual error, making debugging difficult.
Consider adding more detailed error handling:
try { const message = await this.gmail.getMessage({ id, }); return message; - } catch { - console.log(`Could not find message ${id}`); + } catch (error) { + console.log(`Failed to fetch message ${id}: ${error.message}`); + if (error.response?.status === 404) { + console.log('Message may have been deleted'); + } return null; }
Line range hint
508-524: Add message signature verification for Pub/Sub webhooksThe current implementation doesn't verify the authenticity of incoming Pub/Sub messages.
Consider adding message signature verification:
async run(event) { if (this.triggerType === "webhook") { + // Verify Pub/Sub message signature + const signature = event.headers['x-goog-signature']; + const messageId = event.headers['x-goog-message-id']; + if (!signature || !messageId) { + console.log('Missing Pub/Sub message signature or ID'); + return; + } + // Extract the Pub/Sub message data const pubsubMessage = event.body.message; if (!pubsubMessage) { return; }
Line range hint
165-186: Improve security of IAM policy error handlingThe error handling for IAM policy operations could potentially log sensitive information.
Consider sanitizing error messages:
try { const [policy] = await topic.iam.getPolicy(); hasPublisherRole = policy.bindings.find( ({ members, role }) => members.includes("serviceAccount:[email protected]") && role === "roles/pubsub.publisher" ); - } catch { - console.log("Could not retrieve iam policy"); + } catch (error) { + console.log("Failed to retrieve IAM policy:", error.code); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
- pnpm-lock.yamlis excluded by- !**/pnpm-lock.yaml
📒 Files selected for processing (15)
- components/gmail/actions/add-label-to-email/add-label-to-email.mjs(1 hunks)
- components/gmail/actions/create-draft/create-draft.mjs(1 hunks)
- components/gmail/actions/download-attachment/download-attachment.mjs(1 hunks)
- components/gmail/actions/find-email/find-email.mjs(1 hunks)
- components/gmail/actions/remove-label-from-email/remove-label-from-email.mjs(1 hunks)
- components/gmail/actions/send-email/send-email.mjs(1 hunks)
- components/gmail/actions/update-org-signature/update-org-signature.mjs(1 hunks)
- components/gmail/actions/update-primary-signature/update-primary-signature.mjs(1 hunks)
- components/gmail/gmail.app.mjs(1 hunks)
- components/gmail/package.json(1 hunks)
- components/gmail/sources/new-attachment-received/new-attachment-received.mjs(1 hunks)
- components/gmail/sources/new-email-matching-search/new-email-matching-search.mjs(1 hunks)
- components/gmail/sources/new-email-received/new-email-received.mjs(1 hunks)
- components/gmail/sources/new-labeled-email/new-labeled-email.mjs(1 hunks)
- components/gmail/sources/new-sent-email/new-sent-email.mjs(1 hunks)
✅ Files skipped from review due to trivial changes (13)
- components/gmail/actions/add-label-to-email/add-label-to-email.mjs
- components/gmail/actions/create-draft/create-draft.mjs
- components/gmail/actions/download-attachment/download-attachment.mjs
- components/gmail/actions/find-email/find-email.mjs
- components/gmail/actions/remove-label-from-email/remove-label-from-email.mjs
- components/gmail/actions/send-email/send-email.mjs
- components/gmail/actions/update-org-signature/update-org-signature.mjs
- components/gmail/actions/update-primary-signature/update-primary-signature.mjs
- components/gmail/package.json
- components/gmail/sources/new-attachment-received/new-attachment-received.mjs
- components/gmail/sources/new-email-matching-search/new-email-matching-search.mjs
- components/gmail/sources/new-labeled-email/new-labeled-email.mjs
- components/gmail/sources/new-sent-email/new-sent-email.mjs
🔇 Additional comments (2)
components/gmail/gmail.app.mjs (1)
222-222: LGTM! The type change aligns with actual usage.
The change from any to string type for the body prop is correct as the implementation expects string input for both HTML and plaintext body types. This change enforces better type safety.
Let's verify the usage of this prop across the codebase:
components/gmail/sources/new-email-received/new-email-received.mjs (1)
18-18: LGTM: Version increment is appropriate
The version bump from 0.1.8 to 0.1.9 aligns with the changes in the component.
| type: "string", | ||
| label: "Email Body", | ||
| description: "Include an email body as either plain text or HTML. If HTML, make sure to set the \"Body Type\" prop to `html`.", | ||
| }, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking Change: Version bump required
Changing the prop type from any to string is a breaking change that could affect existing implementations passing non-string values. Please ensure:
- The component version is bumped according to semver
- The change is documented in the changelog
WHY
Summary by CodeRabbit
Release Notes
New Features
Version Updates
add-label-to-email: 0.0.5 → 0.0.6create-draft: 0.0.3 → 0.0.4download-attachment: 0.0.3 → 0.0.4find-email: 0.0.6 → 0.0.7remove-label-from-email: 0.0.2 → 0.0.3send-email: 0.1.5 → 0.1.6update-org-signature: 0.0.3 → 0.0.4update-primary-signature: 0.0.3 → 0.0.4new-attachment-received: 0.0.5 → 0.0.6new-email-matching-search: 0.0.4 → 0.0.5new-email-received: 0.1.8 → 0.1.9new-labeled-email: 0.0.5 → 0.0.6new-sent-email: 0.0.5 → 0.0.6package.json: 0.1.11 → 0.1.12gmail.app.mjs: Updated body property type fromanytostring.